<?php
/*
 * 入口文件
 */
define('INTERFACE_PATH', dirname(__FILE__)."/interface");
define("DOWNLOAD_PATH",'/mnt1/cloud/upload');
define("WEB_LOG_PATH",'/home/logs/');
define("LOG_SWITCH",TRUE);
ini_set('date.timezone','Asia/Shanghai');
ini_set('display_errors','on');
require 'interface/functions.php';
$path = getgpc('route');//获取路由
if(empty($path))
{
    ajaxReturn(400, 'request err');
}

//解析路由
$route = parse_path($path);
$controller = isset($route[0]) ? $route[0] : 'index';
if (! preg_match('/^[a-zA-Z]+$/', $controller))
{
    ajaxReturn(400, 'request error');
}
$method = isset($route[1]) ? $route[1] : 'index';
spl_autoload_register('migu_loader');
$app = new $controller();

$app->init($method);